home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16390 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: atglab.bls.com!phoenix!brent
  2. From: brent@phoenix.bss.com (Brent Paulson)
  3. Newsgroups: comp.lang.c++
  4. Subject: Template instatiation with Sun CC
  5. Date: 10 Apr 1996 17:07:34 GMT
  6. Organization: BellSouth Telecommunications
  7. Message-ID: <4kgpsm$7nt@atglab10.atglab.bls.com>
  8. NNTP-Posting-Host: bstfirewall.bst.bls.com
  9.  
  10.  
  11. I'm fairly new to C++, so don't beat me up too bad. I've spent a few days
  12. in the docs, including the Sun C++ docs, but no luck. I'll try to make this
  13. as clear and simple as possible.
  14.  
  15. I'm writing a process in C++ with a Motif GUI. There are multiple directories, 
  16. one exec, many archives. I have defined an object in a header file, and its 
  17. functions in a .C file in the executable (linking) directory. A list of
  18. these instantiated objects is needed globally. The objects are always
  19. declared locally, and placed in a single instance of a collector class.
  20. This class is a template class from Rogue Wave's Tools.h++.
  21.  
  22. In a testbed program, where the scope was one file, everything instantiated
  23. properly. No extern definitions were needed, as the collector was declared
  24. globally and was available to all routines.
  25.  
  26. Moving everything to the development program, the problem is that every
  27. time the header file that contains the declaration is included in an object
  28. file, a new collector object is instantiated. (Appropriate wrappers used.)
  29. The Sun C++ compiler uses compile time instantiation of template classes. 
  30.  
  31. How do I make one instance of an object available among multiple
  32. directories, most of them archives?
  33.  
  34.  
  35. If you wish to reply by email, send to:
  36. Walt.Marchand@bridge.bst.bls.com
  37.  
  38. Thanks in advance.
  39. Walt Marchand
  40. Contractor, BellSouth SNT
  41.  
  42.